1. Field
The exemplary embodiments relate to the computer field. More particularly, the exemplary embodiments relate to a system and method for detecting deadlock in situations involving multitasking.
2. Description of the Related Art
With rapid development of computer techniques, in the current environment, technical applications for multitasking, multithreading or multihandler systems have been widespread. Multitasking refers to one program which has several paths that are concurrently performing. These tasks share the address space of the internal memory and can be performed both concurrently and asynchronously. Deadlock refers to a phenomenon of processes awaiting each other, caused by contending resources, during a procedure of performing two or more processes. If there is no external force, the processes cannot be continued. At such time, the system is referred as being in a state of deadlock. When system deadlock occurs, and the processes that are awaiting each other forever are referred as deadlocked processes. However, since deadlock occurs only in a state such as relating to the interleaving of the threads being performed, or a special condition of a time sequence, it is difficult to detect deadlock.
In a current detection method, processes can be divided as static code analysis and analysis when running. The static code analysis refers to analyzing the target resource program, finding a target thread and related resources, and building the relation map between the thread and the resource. If a cycle occurs, it is deemed a detection of the existence of a deadlock.
The analysis when running, needs to increase extra data structure and the software module. Whenever a thread uses resources (that is, acquires or release resources), it is recorded and analyzed, and if the acquired resource is not identical to the released resource, or the like, it is deemed detection of the existence of a deadlock.
In the related art, the source code of the target program is needed for the detection of deadlock. However, in the situation of joint development of a larger program, less than all of the source codes can be obtained. In the case of a larger amount of source codes, it is difficult to analyze the source codes.
In addition, the current method of dynamic deadlock detection needs to increase the data structure and the software module and will change the action of the target program. For example, when the target program requests resources or releases resources, the target program needs to write a corresponding value into the increased data structure. This will affect the action of the target program, and causes a reduction in the reliability of the obtained result.